package com.gxa.service.impl;

import com.gxa.common.R;
import com.gxa.mapper.AddOrderMapper;
import com.gxa.pojo.Order;
import com.gxa.pojo.Receipt_Order;
import com.gxa.service.AddOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddOrderServiceImpl implements AddOrderService {

    R r = new R();
    @Autowired(required = false)
    private AddOrderMapper addOrderMapper;

    @Override
    public R saveOrderForm(Receipt_Order receipt_order) {
        List<Order> orderList = receipt_order.getOrderList();
        int result = addOrderMapper.addOrder(orderList);
        int result2 = addOrderMapper.addReceiptOrder(receipt_order);
        if (result > 0 && result2 > 0){
            r.setCode(200);
            r.setMsg("success");
        }
        return r;
    }
}
